package realm.inorder.itmill.ui.panel.logged.cadastro.cliente;

import java.io.Serializable;

import realm.inorder.itmill.components.table.DefaultTableModel;
import realm.inorder.persistence.model.Cliente;

public class ClienteTable extends DefaultTableModel<Cliente> {

	public ClienteTable() {
		this.setImmediate(true);
		this.setSelectable(true);
		this.setMultiSelect(false);
	}
	
	public Serializable getBeanId(Cliente t) {
		return t.getId();
	}

	public Class getColumnClass(int columnIndex) {
		return String.class;
	}

	public String[] getColumnNames() {
		return new String[] {"Nome", "CPF"};
	}

	public int getColumnWidth(int columnIndex) {
		switch (columnIndex) {
		case 0:
			return 200;
		case 1:
			return 100;
		}
		return 100;
	}

	public Object getValueAt(Cliente t, int column) {
		switch (column) {
		case 0:
			return t.getPessoa().getNomeRazaoSocial();
		case 1:
			return t.getPessoa().getCpfCnpj();
		}
		return "";
	}

}
